<div>
<form class="form-horizontal" role="form" name="diffCountForm" novalidate>
  <div class="form-ctrl md-whiteframe-z1">
    <div class="form-search" style="height:160px;" ng-class="{true: 'shou'}[flag.formIsFold]" ng-switch="diffCount.timeType.timeTypeCode">
      <div>
        <label style="">业务线</label>
        <md-select ng-model="diffCount.channelCode">
          <md-select-label>{{diffCount.channelCode ? _getNames(diffCount.channelCode,'businessLineName',selector.channelCode) : "全部"}}</md-select-label>
          <md-option ng-value="" ng-click="diffCount.channelCode = undefined">全部</md-option>
          <md-option ng-value="channelCode"  ng-repeat="channelCode in selector.channelCode">{{channelCode.businessLineName}}</md-option>
        </md-select>
      </div>
      <div>
        <label style="">省公司</label>
        <md-select multiple ng-model="diffCount.provinceCode">
          <md-select-label>{{diffCount.provinceCode.length ? _getNames(diffCount.provinceCode,'provinceName',selector.provinceCode) : "全部"}}</md-select-label>
          <md-option ng-value="" ng-click="_checkAll(diffCount,'provinceCode')">全部</md-option>
          <md-option ng-value="province" ng-repeat="province in selector.provinceCode">{{province.provinceName}}</md-option>
        </md-select>
      </div>
      <div>
        <label style="">账期</label>
        <md-select ng-model="diffCount.timeType">
          <md-select-label>{{diffCount.timeType ? _getNames(diffCount.timeType,'timeTypeName',selector.timeType) : "日"}}</md-select-label>
          <md-option ng-value="timeType" ng-repeat="timeType in selector.timeType" >{{timeType.timeTypeName}}</md-option>
        </md-select>
      </div>


      <input-quarter-group start-time="diffCount.quarter.startTime" end-time="diffCount.quarter.endTime" ng-switch-when="4"></input-quarter-group>
      <div ng-if="!diffCount.timeType || diffCount.timeType.timeTypeCode !== '4'">
        <md-input-container flex>
          <label >开始时间</label>
          <input name="dateStartTime" type="date" time-validate="day"  end-time="date.endTime" ng-model="date.startTime"  ng-switch-default required>
          <div ng-messages="diffCountForm.dateStartTime.$error">
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="time-error">开始时间不应大于结束时间</div>
          </div>
          <input name="monthStartTime" time-validate="month" ng-model="date.startTime"  end-time="date.endTime" type="month" ng-switch-when="3" required>
          <div ng-messages="diffCountForm.monthStartTime.$error">
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="time-error">开始时间不应大于结束时间</div>
          </div>
          <input ng-model="date.startTime"  time-validate="year" end-time="date.endTime" type="number" ng-switch-when="5" name="startQuarter" required>
          <div ng-messages="diffCountForm.startQuarter.$error">
            <div ng-message="required">请正确输入时间</div>
            <div ng-message="time-error">开始时间不应大于结束时间</div>
          </div>
        </md-input-container>
        </div>
        <div ng-if="!diffCount.timeType || diffCount.timeType.timeTypeCode !== '4'">
          <md-input-container flex>
            <label>结束时间</label>
            <input name="dateEndTime" time-validate="day" type="date" ng-model="date.endTime"  start-time="date.startTime" ng-switch-default required>
            <div ng-messages="diffCountForm.dateEndTime.$error">
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">结束时间不应小于开始时间</div>
              <div ng-message="too-great">结束时间不应大于当前时间</div>
            </div>
            <input name="monthEndTime" time-validate="month" ng-model="date.endTime"  type="month" start-time="date.startTime" ng-switch-when="3" required>
            <div ng-messages="diffCountForm.monthEndTime.$error">
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">结束时间不应小于开始时间</div>
              <div ng-message="too-great">结束时间不应大于当前时间</div>
            </div>
            <input ng-model="date.endTime" time-validate="year" start-time="date.startTime" type="number" ng-switch-when="5" name="endQuarter" required>
              <div ng-messages="diffCountForm.endQuarter.$error">
              <div ng-message="required">请正确输入时间</div>
              <div ng-message="time-error">结束时间不应小于开始时间</div>
              <div ng-message="too-great">结束时间不应大于当前时间</div>
            </div>
          </md-input-container >
        </div>
      </div>
    <i class="glyphicon glyphicon-chevron-up shrinkage" ng-click="flag.formIsFold=true" ng-show="flag.showTable && !(quarterInvalid||diffCountForm.$invalid)"></i>
    <md-button ng-click="getDiffCount()" ng-disabled="quarterInvalid||diffCountForm.$invalid" class="md-fab md-primary md-hue-1" aria-label="Profile">
      <i class="glyphicon glyphicon-search"  ng-show="!flag.formIsFold"></i>
      <i class="glyphicon glyphicon-arrow-down" style="margin-top:28px;" ng-show="flag.formIsFold"></i>
    </md-button>
  </div>
</form>
<div class="table-info" ng-controller="diffCountViewCtrl">
  <div >
    <div class="menus" ng-show="flag.showTable">
      <md-button aria-label="列表" class="md-raised ico-btn" ng-click="flag.showChart = false">
        <img src="images/tables.png">
      </md-button>
      <md-button aria-label="图表" class="md-raised ico-btn" ng-click="flag.showChart = true">
        <img src="images/charts.png">
      </md-button>
      <form action="{{exportUrl}}"  target="_black"  method="post" style="display: initial;" ng-show="exportObj.isPrepare === true">
        <input type='hidden' name="data"  value='{{exportObj.param}}'>
        <md-button  type="submit"  class="md-raised">导出Excel</md-button>
      </form>
      <span class="division" ng-show="flag.showChart"></span>
      <md-button class="md-raised" ng-show="flag.showChart && (viewObj.busArr.indexOf('天猫旗舰店') !== -1)" style="background-color: #FF9800;color:white" ng-click="tmall()">天猫旗舰店</md-button>
      <md-button class="md-raised" ng-show="flag.showChart && (viewObj.busArr.indexOf('银行总对总') !== -1)" style="background-color: #FF9800;color:white" ng-click="bankATA()">银行总对总</md-button>
      <md-button class="md-raised" ng-show="flag.showChart && (viewObj.busArr.indexOf('移动商城') !== -1)" style="background-color: #FF9800;color:white" ng-click="cmall()">移动商城</md-button>
       <md-button class="md-raised" ng-show="flag.showChart && (viewObj.busArr.indexOf('灵犀语音') !== -1)" style="background-color: #FF9800;color:white" ng-click="consonanceVoice()">灵犀语单</md-button>
        <md-button class="md-raised" ng-show="flag.showChart && (viewObj.busArr.indexOf('有价卡') !== -1)" style="background-color: #FF9800;color:white" ng-click="valuableCard()">有价卡</md-button>
    </div>
    <div class="table-detail" ng-show="flag.showTable && !flag.showChart">
      <div class="t_r" style="overflow-x: scroll;">
        <table class="table table-bordered" style="min-width: 100%;max-width: none;table-layout: fixed;word-break:break-all;">
          <caption style="text-align:center;font-size:large;font-weight:bold;color:black">{{viewObj.title}}</caption>
          <thead>
            <tr>
              <th width="260px;" rowspan="2">账期</th>
              <th width="80px;" rowspan="2">省代码</th>
              <th width="80px;" rowspan="2">省公司</th>
              <th width="290px;" ng-repeat="businessLine in viewObj.busArr">
                {{businessLine}}
              </th>
            </tr>
            <tr>
              <th ng-repeat="businessLine in viewObj.busArr" class="diffcount-td">
                <div style="width:38%;">差异条数</div>
                <div style="width:24%;">差异率</div>
                <div style="width:38%;">入库条数</div>
              </th>
            </tr>
          </thead>
          <tbody>
            <tr ng-repeat="item in viewObj.series">
              <td width="260px;">{{viewObj.duration}}</td>
              <td width="80px;">{{item.code}}</td>
              <td width="80px;">{{item.name}}</td>
              <td width="290px;" ng-repeat="subItem in item.data" class="diffcount-td">
                <div style="width:38%;">{{subItem.differencesCount}}</div>
                <div style="width:24%;">{{subItem.differencesRate||subItem.differencesRate === 0?(subItem.differencesRate.toFixed(4)+'%'):''}}</div>
                <div style="width:38%;">{{subItem.fileStorageCount}}</div>
              </td>
            </tr>
            <tr class="summary" >
              <td width="169px;">{{viewObj.total.name}}</td>
              <td width="80px;"></td>
              <td width="80px;"></td>
              <td width="290px;" ng-repeat="item in viewObj.total.data" class="diffcount-td">
                <div style="width:38%;">{{item.differencesCount}}</div>
                <div style="width:24%;">{{item.differencesRate||item.differencesRate === 0?(item.differencesRate.toFixed(4)+'%'):''}}</div>
                <div style="width:38%;">{{item.fileStorageCount}}</div>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
    <div ng-show="flag.showChart && flag.showTable">
      <div id="tmallChart" style="height:375px" ng-show="viewObj.showType === '天猫旗舰店'"></div>
      <div id="cmallChart" style="height:375px" ng-show="viewObj.showType === '移动商城'"></div>
      <div id="bankATAChart" style="height:375px" ng-show="viewObj.showType === '银行总对总'"></div>
      <div id="consonanceVoice" style="height:375px" ng-show="viewObj.showType === '灵犀语音'"></div>
      <div id="valuableCard" style="height:375px" ng-show="viewObj.showType === '有价卡'"></div>
    </div>
  </div>
</div>
</div>